//
//  YTPriceBonusViewCell.m
//  YiTuDriverClient
//
//  Created by 石少庸 on 2017/8/2.
//  Copyright © 2017年 Yitu. All rights reserved.
//

#import "YTPriceBonusViewCell.h"
#import "YTPriceBonusModel.h"

@interface YTPriceBonusViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *priceText;
@property (weak, nonatomic) IBOutlet UILabel *titleText;
@property (weak, nonatomic) IBOutlet UILabel *categoryText;
@property (weak, nonatomic) IBOutlet UILabel *squareText;
@property (weak, nonatomic) IBOutlet UILabel *timeText;
@property (weak, nonatomic) IBOutlet UIImageView *bgImage;

@property (weak, nonatomic) IBOutlet UILabel *rmbSybl;
@property (weak, nonatomic) IBOutlet UIImageView *dotSybl1;
@property (weak, nonatomic) IBOutlet UIImageView *dotSybl2;
@property (weak, nonatomic) IBOutlet UIImageView *dotSybl3;
@end

@implementation YTPriceBonusViewCell

- (void)setModel:(YTPriceBonusModel *)model {
    _model = model;
    _priceText.text = [model.amount substringWithRange:NSMakeRange(0, model.amount.length - 3)];
    _titleText.text = model.name;
    _categoryText.text = model.productTypeDescription;
    _timeText.text = [NSString stringWithFormat:@"%@到期", model.expireTime];
    if (![model.status isEqualToString:@"1"]) {
        _bgImage.image = [UIImage imageNamed:@"profile_bonus_expired"];
        _rmbSybl.textColor = [UIColor darkGrayColor];
        _dotSybl1.backgroundColor = [UIColor darkGrayColor];
        _dotSybl2.backgroundColor = [UIColor darkGrayColor];
        _dotSybl3.backgroundColor = [UIColor darkGrayColor];
        _priceText.textColor = [UIColor darkGrayColor];
    } else {
        _bgImage.image = [UIImage imageNamed:@"profile_bonus"];
        _rmbSybl.textColor = kOrangeColor;
        _dotSybl1.backgroundColor = kOrangeColor;
        _dotSybl2.backgroundColor = kOrangeColor;
        _dotSybl3.backgroundColor = kOrangeColor;
        _priceText.textColor = kOrangeColor;
    }
}

- (void)prepareForReuse {
    [super prepareForReuse];
    _priceText.text = nil;
    _titleText.text = nil;
    _categoryText.text = nil;
    _timeText.text = nil;
    _bgImage.image = nil;
    _rmbSybl.textColor = kOrangeColor;
    _dotSybl1.backgroundColor = kOrangeColor;
    _dotSybl2.backgroundColor = kOrangeColor;
    _dotSybl3.backgroundColor = kOrangeColor;
    _priceText.textColor = kOrangeColor;
}

@end

